package edu.its.dreamteam.web.util;

import java.util.List;

import org.apache.tapestry.ValueEncoder;

import edu.its.dreamteam.daf.beans.Club;

public class ClubValueEncoder implements ValueEncoder<Club> {
	private List<Club> clubList;
	
	public ClubValueEncoder(List<Club> clubList) {
		this.clubList = clubList;
	}

	public String toClient(Club club) {		
		return club.getIdClub();
	}

	public Club toValue(String value) {
		for(Club club : clubList){
			if(club.getIdClub().equals(value)){
				return club;
			}
		}
		return null;
	}

	

}
